package com.hangsu.train.components.convert;

import com.hangsu.train.components.entity.Permiss;
import com.hangsu.train.components.params.PermissParam;
import com.hangsu.train.components.params.PermissUpdateParam;
import com.hangsu.train.components.vo.PermissVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author lyy
 * @Date 2022/2/22
 */
@Mapper(componentModel = "spring")
public interface PermissConvert {

    /**
     * PermissParam to Permiss
     *
     * @param param
     * @return
     */
    Permiss convert(PermissParam param);


    /**
     * PermissUpdateParam to Permiss
     *
     * @param param
     * @return
     */
    Permiss convert(PermissUpdateParam param);

    @Mappings({
            @Mapping(source = "name", target = "title"),
            @Mapping(source = "id", target = "key")
    })
    PermissVo convert(Permiss permiss);

}
